from _load import ANTHROPIC_API_KEY, OPENAI_API_KEY, SPECK_API_KEY
from speck import AsyncOpenAI

ao = AsyncOpenAI(api_key=OPENAI_API_KEY)

import asyncio
import tracemalloc
tracemalloc.start()

async def main():
    ret = await ao.chat.completions.create(
        model="gpt-3.5-turbo-1106",
        messages=[
            {
                "role": "system",
                "content": "Hello, how are you?",
            },
            {
                "role": "user",
                "content": "Hello, how are you?",
            },
        ],
        temperature=0.0,
        stream=False,
    )
    print(ret)

    ret = await ao.chat.completions.create(
        model="gpt-3.5-turbo-1106",
        messages=[
            {
                "role": "system",
                "content": "Hello, how are you?",
            },
            {
                "role": "user",
                "content": "Hello, how are you? Count to 200",
            },
        ],
        temperature=0.0,
        stream=True,
    )
    async for i in ret:
        print(i)

asyncio.run(main())